-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3D Generation: InstantMesh Training, Inference, and Eval Scripts #681
Open
HaFred
wants to merge
26
commits into
mindspore-lab:master
Choose a base branch
from
HaFred:itmh_oct1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HaFred
requested review from
CaitinZhao,
SamitHuang and
zhanghuiyao
as code owners
October 1, 2024 08:27
…lback, and some refactoring
SamitHuang
reviewed
Oct 25, 2024
examples/instantmesh/README.md
Outdated
|
||
The illustrations here are better viewed in viewers than with HTML support (e.g., the vscode built-in viewer). | ||
|
||
## Environments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls refactor this section referring to
https://github.com/mindspore-lab/mindone/wiki/%E6%A8%A1%E5%9E%8B%E7%89%88%E6%9C%AC%E4%B9%A6%E5%86%99%E6%A0%B7%E4%BE%8B
…age 1 ckpt with eval.py seamlessly
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements InstantMesh for 3D meshing using multiview images. The torch-cuda version with textures is shown below.
Input is
nx3xhxw
multiview video and the output is a 3D meshmesh.obj
file with vertices, faces.HW environment specs are as follows.
3D Mesh Demos
Inference demos with the pretrained checkpoint can be found in the readme, with any HTML renderer such as VSCode it can be viewed and interacted with smoothly as shown below.
These links can be found here for easy access.
Input multiview images are illustrated here, respectively. Kindly notice that the input multiview images can be either retrieved viav the SV3D pipeline or Zero123++ pipeline as in the original implementation, the paper's core contribution is the process of 3D meshing out of multiview images.
Limitations in Inference
1. Cache Miss in
mint.unique()
and other ACLNN OperatorsAs introduced in the Readme, InstantMesh extracts isosurface for meshing using FlexiCubes, which essentially requires a unique operation to determine the surfaces of an object. Unfortunately, the operator
mint.unique()
remains not supported by ACLNN but only AICPU, and hence leads to the program being stuck by cache misses, as told by the MindSpore framework colleagues. Once themint.unique()
is fully supported by A+M, we will implement the 3D meshing with FlexiCubes for higher resolution.(Update on August 1st: Turns out the CANN operator
aclnnUniqueDim
takes too long. Interacting with the framework and CANN team for solutions.)Workaround: 3D Meshing with the Raw Triplane Features using Marching Cubes
For the reasons above, we have to find a workaround to extract 3D meshes from multiview images (from SV3D in our case). Here in this PR, since we already have a rough SDF extracted from the SDF MLP heads with the triplane features input, a straightforward way is to take the rough SDF and feed it to the classic isosurface extraction method, such as the Marching Cubes. As the optimization in the Marching Cubes lacks degrees of freedom to represent high-quality meshes, it tends to use more vertices (naturally more faces, triangles) to fit an irregular 3D shape, especially when the 3D shape cannot be approximated to a surface. Details can be found in the FlexiCubes' paper.
2. CUDA Extension for Rasterization
InstantMesh uses nvdiffrast for uv map rasterization and 2D rendering for the FlexiCube 3D volume. Bypass this for now.